package org.example.web;

/**
 * @author jiangzhe
 * @create 2022/11/3 19:17
 */
import org.example.feign.NodeJsClient;
import org.example.feign.PythonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("java")
public class MyController {

    @Autowired
    PythonClient pythonClient;

    @Autowired
    NodeJsClient nodeJsClient;

    @GetMapping("/consumer/python")
    public String python(){
        String helloText = pythonClient.printResult();
        System.out.println(helloText);
        return helloText;
    }

    @GetMapping("/consumer/nodejs")
    public String nodejs(){
        String helloText = nodeJsClient.printRes();
        System.out.println(helloText);
        return helloText;
    }

    @GetMapping("/provider/{who}")
    public String java(String who){
        String res = "from " + who + " to java";
        System.out.println(res);
        return res;
    }
}
